package com.bright.ghj.overt.service.impl;

import com.bright.ghj.common.pojo.vo.PageVO;
import com.bright.ghj.common.util.StringUtil;
import com.bright.ghj.overt.constant.DataConstant;
import com.bright.ghj.overt.constant.PublicConstant;
import com.bright.ghj.overt.enums.DataStatus;
import com.bright.ghj.overt.enums.FieldAlign;
import com.bright.ghj.common.enums.FieldType;
import com.bright.ghj.overt.manager.DistZtManager;
import com.bright.ghj.overt.pojo.dto.DistDTO;
import com.bright.ghj.overt.pojo.dto.ZtDTO;
import com.bright.ghj.overt.pojo.query.DistQuery;
import com.bright.ghj.overt.pojo.query.StatByZtQuery;
import com.bright.ghj.overt.pojo.vo.*;
import com.bright.ghj.overt.service.StatService;
import com.bright.ghj.common.util.DateUtil;
import com.bright.ghj.overt.util.EntityManagerUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.*;

import static com.bright.ghj.overt.constant.StatConstant.*;

/**
 * @Author hxj
 * @Date 2024/1/24 17:54
 * @Description
 */
@Component
@RequiredArgsConstructor
public class StatServiceImpl implements StatService {

    private final DistZtManager distZtManager;

    @PersistenceContext
    private final EntityManager entityManager;

    private final DataConstant dataConstant;

    @Override
    public List<TableHeaderVO> listStatByZtTableHeaders() {
        List<TableHeaderVO> result = new ArrayList<>();
        result.add(new TableHeaderVO("distName", "地区/单位名称", FieldAlign.LEFT));
        result.add(new TableHeaderVO(STAT_BY_ZT_TOTAL, "总数", FieldAlign.RIGHT));
//        result.add(new TableHeaderVO(STAT_BY_ZT_EMPTY, "未录入数据", FieldAlign.RIGHT));
//        result.add(new TableHeaderVO(STAT_BY_ZT_FILLED, "已录入数据", FieldAlign.RIGHT));
//        result.add(new TableHeaderVO(STAT_BY_ZT_PROCESS, "待处理数据", FieldAlign.RIGHT));
        result.add(new TableHeaderVO(STAT_BY_ZT_NOT_AUDIT, "待审核数据", FieldAlign.RIGHT));
        result.add(new TableHeaderVO(STAT_BY_ZT_NOT_PUBLISH, "待发布数据", FieldAlign.RIGHT));
//        result.add(new TableHeaderVO("back", "未录入数据", FieldAlign.RIGHT));
        result.add(new TableHeaderVO(STAT_BY_ZT_PUBLISHED, "已发布数据", FieldAlign.RIGHT));
        result.add(new TableHeaderVO("auditRate", "审核率", FieldAlign.RIGHT));
        result.add(new TableHeaderVO("publishRate", "发布率", FieldAlign.RIGHT));
        return result;
    }

    @Override
    public List<StatParamVO> listStatByZtParams() {
        List<StatParamVO> result = new ArrayList<>();
        // 日期参数由起止两个框构成 所以fieldName传的两个
        result.add(new StatParamVO("publicDateBegin,publicDateEnd", "规定公开时间", FieldType.DATE));
        result.add(new StatParamVO("tableName", "查询公开表", FieldType.CHAR));
        return result;
    }


    @Override
    public PageVO<StatByZtDataVO> pageStatByZtData(StatByZtQuery query) {
        Map<String, Object> params = new HashMap<>();
        String groupBySql;
        // 根据地区编号的长度
        String distNo = query.getDistNo();
        if (distNo.length() == 2) {
            groupBySql = "left(distNo, 4)";
        } else if (distNo.length() == 4) {
            groupBySql = "left(distNo, 6)";
        } else if (distNo.length() == 6) {
            groupBySql = "distNo";
        } else {
            groupBySql = "ztId";
        }


        StringBuilder querySQL = new StringBuilder("select ").append(groupBySql).append(" as distNo, convert(int,count(*)) as total, ")
                // 已审核未发布
                .append("convert(int,sum(case when chkFlag=1 and okFlag=1 and (isUpload is null or isUpload=0) then 1 else 0 end)) as notPublish, ")
                // 已发布
                .append("convert(int,sum(case when isUpload=1 then 1 else 0 end)) as published ");


        querySQL.append(" from openReportRecord where distNo like :distNo and category=:category");
        params.put("distNo", distNo + "%");
        String category = getCategoryByYwType(query.getYwType());
        params.put("category", category);
        if (query.getPublicDateBegin() != null) {
            querySQL.append(" and years*100+months>=:yearMonthBegin");
            params.put("yearMonthBegin", getYearMonthValueByDate(query.getPublicDateBegin()));
        }
        if (query.getPublicDateEnd() != null) {
            querySQL.append(" and years*100+months<=:yearMonthEnd");
            params.put("yearMonthEnd", getYearMonthValueByDate(query.getPublicDateEnd()));
        }
        if (StringUtil.isNotEmpty(query.getZtId())) {
            querySQL.append(" and ztId=:ztId");
            params.put("ztId", query.getZtId());
        }
        if (StringUtil.isNotEmpty(query.getTableName())) {
            querySQL.append(" and tableName=:tableName");
            params.put("tableName", query.getTableName());
        }
        querySQL.append(" group by ").append(groupBySql);

        List<StatByZtDataVO> resultList = EntityManagerUtil.queryForClass(entityManager, querySQL.toString(), params, StatByZtDataVO.class);

        int total = 0, notAudit = 0, notPublish = 0, published = 0;
        for (StatByZtDataVO statByZtDataVO : resultList) {
            // 设值待审核、审核率、发布率
            // 待审核=总数-待发布-已发布
            statByZtDataVO.setNotAudit(statByZtDataVO.getTotal() - statByZtDataVO.getNotPublish() - statByZtDataVO.getPublished());
            // 审核率
            statByZtDataVO.setAuditRate(getRate(statByZtDataVO.getTotal() - statByZtDataVO.getNotAudit(), statByZtDataVO.getTotal()));
            // 发布率
            statByZtDataVO.setPublishRate(getRate(statByZtDataVO.getPublished(), statByZtDataVO.getTotal()));
            // 地区名称在后面设值
            // 计算合计值
            total += statByZtDataVO.getTotal();
            notAudit += statByZtDataVO.getNotAudit();
            notPublish += statByZtDataVO.getNotPublish();
            published += statByZtDataVO.getPublished();
        }

        List<StatByZtDataVO> dataVOS = new ArrayList<>();

        // 最前面来一条汇总
        StatByZtDataVO totalData = new StatByZtDataVO();
        totalData.setDistNo(distNo);
        totalData.setDistName("合计");
        totalData.setTotal(total);
        totalData.setNotAudit(notAudit);
        totalData.setNotPublish(notPublish);
        totalData.setPublished(published);
        totalData.setAuditRate(getRate(notPublish, total));
        totalData.setPublishRate(getRate(published, total));
        dataVOS.add(totalData);


        // 获取本级及下级所有地区
        int nextLength = distZtManager.getNextLength(distNo);
        if (nextLength == 12) {
            DistQuery distQuery = new DistQuery();
            distQuery.setDistNo(distNo);
            distQuery.setUserDistNo(query.getUserDistNo());
            distQuery.setUserZtId(query.getUserZtId());
            List<ZtDTO> ztDTOS = distZtManager.listZtByDistNo(distQuery);
            for (ZtDTO ztDTO : ztDTOS) {
                dataVOS.add(getDataVOByNo(resultList, ztDTO.getZtId(), ztDTO.getZtName()));
            }

        } else {
            List<DistDTO> dist = distZtManager.listDistByDistNoAndLength(distNo, nextLength, query.getUserDistNo());
            for (DistDTO distDTO : dist) {
                dataVOS.add(getDataVOByNo(resultList, distDTO.getDistNo(), distDTO.getDistName()));
            }
        }


        // 这里虽然返回PageVO 但不分页 只返回两个统计级别 数据条数有限 方便汇总
        PageVO<StatByZtDataVO> pageVO = new PageVO<>();
        pageVO.setData(dataVOS);
        pageVO.setTotal((long) dataVOS.size());
        pageVO.setPageCount(1);
        return pageVO;
    }

    @Deprecated
    public PageVO<StatByZtDataOldVO> pageStatByZtDataOld(StatByZtQuery query) {
//        Map<String, Object> params = new HashMap<>();
//        String groupBySql;
//        // 根据地区编号的长度
//        String distNo = query.getDistNo();
//        if (distNo.length() == 2) {
//            groupBySql = "left(distNo, 4)";
//        } else if (distNo.length() == 4) {
//            groupBySql = "left(distNo, 6)";
//        } else if (distNo.length() == 6) {
//            groupBySql = "distNo";
//        } else {
//            groupBySql = "ztId";
//        }
//
//
//        StringBuilder querySQL = new StringBuilder("select ").append(groupBySql).append(" as distNo, count(*) as total, ")
//                // 待处理数据
//                .append("sum(case when status=").append(DataStatus.WAIT_FOR_PROCESS.getStatus()).append(" or status=").append(DataStatus.AUDIT_FAIL.getStatus()).append(" then 1 else 0 end) as process, ")
//                // 待审核数据
//                .append("sum(case when status=").append(DataStatus.READY_AUDIT.getStatus()).append(" then 1 else 0 end) as notAudit, ")
//                // 待发布
//                .append("sum(case when chkFlag=1 and okFlag=1 and (isUpload is null or isUpload=0) then 1 else 0 end) as notPublish, ")
//                // 已发布
//                .append("sum(case when isUpload=1 then 1 else 0 end) as published ");
//
//
//        querySQL.append(" from openReportRecord where years*100+months>=:yearMonthBegin and years*100+months<=:yearMonthEnd and distNo like :distNo and category=:category");
//        if (query.getZtId() != null) {
//            querySQL.append(" and ztId=:ztId");
//            params.put("ztId", query.getZtId());
//        }
//        if (query.getTableName() != null) {
//            querySQL.append(" and tableName=:tableName");
//            params.put("tableName", query.getTableName());
//        }
//        querySQL.append(" group by ").append(groupBySql);
//
//        params.put("yearMonthBegin", getYearMonthValueByDate(query.getPublicDateBegin()));
//        params.put("yearMonthEnd", getYearMonthValueByDate(query.getPublicDateEnd()));
//        params.put("distNo", distNo + "%");
//
//        String category = getCategoryByYwType(query.getYwType());
//        params.put("category", category);
//
//        List<StatByZtDataOldVO> resultList = EntityManagerUtil.queryForClass(entityManager, querySQL.toString(), params, StatByZtDataOldVO.class);
//
//        long total = 0, empty = 0, filled = 0, process = 0, notAudit = 0, notPublish = 0, published = 0, backed = 0;
//        for (StatByZtDataOldVO statByZtDataVO : resultList) {
//            // 设值未录入总数、已录入总数、录入率、发布率
//            // 已录入总数=待处理+待审核+待发布+已发布
//            statByZtDataVO.setFilled(statByZtDataVO.getProcess() + statByZtDataVO.getNotAudit() + statByZtDataVO.getNotPublish() + statByZtDataVO.getPublished());
//            // 未录入=总数-已录入
//            statByZtDataVO.setEmpty(statByZtDataVO.getTotal() - statByZtDataVO.getFilled());
//            // 录入率
//            statByZtDataVO.setFillRate(getRate(statByZtDataVO.getFilled(), statByZtDataVO.getTotal()));
//            // 发布率
//            statByZtDataVO.setPublishRate(getRate(statByZtDataVO.getPublished(), statByZtDataVO.getTotal()));
//            // 地区名称在后面设值
//            // 计算合计值
//            total += statByZtDataVO.getTotal();
//            empty += statByZtDataVO.getEmpty();
//            filled += statByZtDataVO.getFilled();
//            process += statByZtDataVO.getProcess();
//            notAudit += statByZtDataVO.getNotAudit();
//            notPublish += statByZtDataVO.getNotPublish();
//            published += statByZtDataVO.getPublished();
////            backed += statByZtDataVO.getBacked();
//        }
//
//        List<StatByZtDataOldVO> dataVOS = new ArrayList<>();
//
//        // 最前面来一条汇总
//        StatByZtDataOldVO totalData = new StatByZtDataOldVO();
//        totalData.setDistNo(distNo);
//        totalData.setDistName("合计");
//        totalData.setTotal(total);
//        totalData.setEmpty(empty);
//        totalData.setFilled(filled);
//        totalData.setProcess(process);
//        totalData.setNotAudit(notAudit);
//        totalData.setNotPublish(notPublish);
//        totalData.setPublished(published);
//        totalData.setFillRate(getRate(filled, total));
//        totalData.setPublishRate(getRate(published, total));
//        dataVOS.add(totalData);
//
//
//        // 获取本级及下级所有地区
//        int nextLength = distZtManager.getNextLength(distNo);
//        if (nextLength == 12) {
//            DistQuery distQuery = new DistQuery();
//            distQuery.setDistNo(distNo);
//            distQuery.setUserDistNo(query.getUserDistNo());
//            distQuery.setUserZtId(query.getUserZtId());
//            List<ZtDTO> ztDTOS = distZtManager.listZtByDistNo(distQuery);
//            for (ZtDTO ztDTO : ztDTOS) {
//                dataVOS.add(this.getDataVOByNoOld(resultList, ztDTO.getZtId(), ztDTO.getZtName()));
//            }
//
//        } else {
//            List<DistDTO> dist = distZtManager.listDistByDistNoAndLength(distNo, nextLength, query.getUserDistNo());
//            for (DistDTO distDTO : dist) {
//                dataVOS.add(this.getDataVOByNoOld(resultList, distDTO.getDistNo(), distDTO.getDistName()));
//            }
//        }
//
//
//        // 这里虽然返回PageVO 但不分页 只返回两个统计级别 数据条数有限 方便汇总
        PageVO<StatByZtDataOldVO> pageVO = new PageVO<>();
//        pageVO.setData(dataVOS);
//        pageVO.setTotal((long) dataVOS.size());
//        pageVO.setPageCount(1);
        return pageVO;
    }

    private String getCategoryByYwType(Integer ywType) {
        String category;
        if (ywType == PublicConstant.GK_TYPE_DW) {
            category = dataConstant.DW_CATEGORY;
        } else if (ywType == PublicConstant.GK_TYPE_SW) {
            category = dataConstant.SW_CATEGORY;
        } else {
            category = dataConstant.CW_CATEGORY;
        }
        return category;
    }

    private StatByZtDataOldVO getDataVOByNoOld(List<StatByZtDataOldVO> resultList, String distNo, String distName) {
        StatByZtDataOldVO dataVO = null;
        for (StatByZtDataOldVO eachVO : resultList) {
            if (StringUtil.equals(eachVO.getDistNo(), distNo)) {
                dataVO = eachVO;
                break;
            }
        }
        if (dataVO == null) {
            // 没有这个地区的数据 新增一个0的记录
            dataVO = new StatByZtDataOldVO();
            dataVO.setDistNo(distNo);
            dataVO.setDistName(distName);
        } else {
            // 设置账套名称
            dataVO.setDistName(distName);
        }
        return dataVO;
    }

    private StatByZtDataVO getDataVOByNo(List<StatByZtDataVO> resultList, String distNo, String distName) {
        StatByZtDataVO dataVO = null;
        for (StatByZtDataVO eachVO : resultList) {
            if (StringUtil.equals(eachVO.getDistNo(), distNo)) {
                dataVO = eachVO;
                break;
            }
        }
        if (dataVO == null) {
            // 没有这个地区的数据 新增一个0的记录
            dataVO = new StatByZtDataVO();
            dataVO.setDistNo(distNo);
            dataVO.setDistName(distName);
        } else {
            // 设置账套名称
            dataVO.setDistName(distName);
        }
        return dataVO;
    }

    private String getRate(long num1, long num2) {
        // 如果被除数为0
        if (num2 == 0) {
            return "100%";
        }
        return (num1 / num2)*100 + "%";
    }

    /**
     * 按年份*100+月份的方式返回一个值方便统计表处理年月范围
     * @param publicDateBegin
     * @return
     */
    private Object getYearMonthValueByDate(Date publicDateBegin) {

        int year = Integer.parseInt(DateUtil.getYearOrMonthOrDay(publicDateBegin, Calendar.YEAR));
        int month = Integer.parseInt(DateUtil.getYearOrMonthOrDay(publicDateBegin, Calendar.MONTH));

        return year * 100 + month;
    }

    @Override
    public List<TableHeaderVO> listStatByZtDetailTableHeaders() {
        List<TableHeaderVO> result = new ArrayList<>();
        TableHeaderVO idHeader = new TableHeaderVO("id", "id", FieldAlign.LEFT);
        idHeader.setHidden(true);
        result.add(idHeader);
//        result.add(new TableHeaderVO("jczt", "监察状态", FieldAlign.LEFT));
//        result.add(new TableHeaderVO("remaining", "剩余时限", FieldAlign.LEFT));
        result.add(new TableHeaderVO("ztName", "公开单位", FieldAlign.LEFT));
        result.add(new TableHeaderVO("longTitle", "公开项目名称", FieldAlign.LEFT));
        result.add(new TableHeaderVO("statusFlag", "数据状态", FieldAlign.LEFT));
//        result.add(new TableHeaderVO("publicDate", "规定公开时间", FieldAlign.CENTER));
        result.add(new TableHeaderVO("uploadDate", "实际公开时间", FieldAlign.CENTER));

        return result;
    }

    @Override
    public PageVO<StatByZtDetailDataVO> pageStatByZtDetailData(StatByZtQuery query) {

        Map<String, Object> params = new HashMap<>();

        StringBuilder queryCountSQL= new StringBuilder("select count(*) from openReportRecord where distNo like :distNo and category=:category");
        params.put("distNo", query.getDistNo() + "%");
        String category = getCategoryByYwType(query.getYwType());
        params.put("category", category);
        if (query.getPublicDateBegin() != null) {
            queryCountSQL.append(" and years*100+months>=:yearMonthBegin");
            params.put("yearMonthBegin", getYearMonthValueByDate(query.getPublicDateBegin()));
        }
        if (query.getPublicDateEnd() != null) {
            queryCountSQL.append(" and years*100+months<=:yearMonthEnd");
            params.put("yearMonthEnd", getYearMonthValueByDate(query.getPublicDateEnd()));
        }
        if (StringUtil.isNotEmpty(query.getZtId())) {
            queryCountSQL.append(" and ztId=:ztId");
            params.put("ztId", query.getZtId());
        }
        if (StringUtil.isNotEmpty(query.getTableName())) {
            queryCountSQL.append(" and tableName=:tableName");
            params.put("tableName", query.getTableName());
        }

        // 获取是点哪个字段下挖
        String detailColumn = query.getDetailColumn();
        switch (detailColumn) {
//            case STAT_BY_ZT_EMPTY:
//                // 未录入
//                queryCountSQL.append(" and (isUpload is null or isUpload=0) and (chkFlag is null or chkFlag=0)");
//                queryCountSQL.append(" and status<>").append(DataStatus.WAIT_FOR_PROCESS.getStatus());
//                queryCountSQL.append(" and status<>").append(DataStatus.AUDIT_FAIL.getStatus());
//                queryCountSQL.append(" and status<>").append(DataStatus.READY_AUDIT.getStatus());
//                break;
//
//            case STAT_BY_ZT_FILLED:
//                queryCountSQL.append(" and (chkFlag=1 or isUpload=1");
//                queryCountSQL.append(" or status=").append(DataStatus.WAIT_FOR_PROCESS.getStatus());
//                queryCountSQL.append(" or status=").append(DataStatus.AUDIT_FAIL.getStatus());
//                queryCountSQL.append(" or status=").append(DataStatus.READY_AUDIT.getStatus()).append(")");
//                break;
//
//            case STAT_BY_ZT_PROCESS:
//                queryCountSQL.append(" and (status=").append(DataStatus.WAIT_FOR_PROCESS.getStatus());
//                queryCountSQL.append(" or status=").append(DataStatus.AUDIT_FAIL.getStatus()).append(")");
//                break;
//
//            case STAT_BY_ZT_NOT_AUDIT:
//                queryCountSQL.append(" and status=").append(DataStatus.READY_AUDIT.getStatus());
//                break;
            case STAT_BY_ZT_NOT_AUDIT:
                queryCountSQL.append(" and (isUpload is null or isUpload=0) and (okFlag is null or okFlag=0)");
                break;

            case STAT_BY_ZT_NOT_PUBLISH:
                queryCountSQL.append(" and chkFlag=1 and okFlag=1 and (isUpload is null or isUpload=0)");
                break;

            case STAT_BY_ZT_PUBLISHED:
                queryCountSQL.append(" and isUpload=1");
                break;

            default:
                break;
        }

        // 求总记录数
        Long total = EntityManagerUtil.queryForCount(entityManager, queryCountSQL.toString(), params);
        Integer pageCount = (int) Math.ceil((double) total / query.getPageSize());

        // 求分页记录
        List<StatByZtDetailDataVO> resultList;
        if (total != 0) {
            String querySQL = StringUtil.replace(queryCountSQL.toString(), "count(*)",
                    "id as id, ztName as ztName, longTitle as longTitle, status_flag as statusFlag, uploadDate as uploadDate");
            resultList = EntityManagerUtil.queryForClass(entityManager, querySQL, params, StatByZtDetailDataVO.class, query);
        } else {
            resultList = new ArrayList<>();
        }

        PageVO<StatByZtDetailDataVO> pageVO = new PageVO<>();
        pageVO.setTotal(total);
        pageVO.setPageCount(pageCount);
        pageVO.setData(resultList);
        return pageVO;
    }

    @Override
    public List<TableHeaderVO> listOpenReportRecordTableHeaders() {
        List<TableHeaderVO> result = new ArrayList<>();
        TableHeaderVO idHeader = new TableHeaderVO("id", "id", FieldAlign.LEFT);
        idHeader.setHidden(true);
        result.add(idHeader);
//        result.add(new TableHeaderVO("jczt", "监察状态", FieldAlign.LEFT));
//        result.add(new TableHeaderVO("remaining", "剩余时限", FieldAlign.LEFT));
        result.add(new TableHeaderVO("ztName", "公开机构", FieldAlign.LEFT));
        result.add(new TableHeaderVO("dateStr", "数据发生时间", FieldAlign.LEFT));
        result.add(new TableHeaderVO("longTitle", "公开数据标题", FieldAlign.LEFT));
        result.add(new TableHeaderVO("statusFlag", "当前状态", FieldAlign.LEFT));
//        result.add(new TableHeaderVO("publicDate", "规定公开时间", FieldAlign.CENTER));
        result.add(new TableHeaderVO("writer", "录入人", FieldAlign.LEFT));
        result.add(new TableHeaderVO("writeDate", "录入时间", FieldAlign.CENTER));
        return result;
    }

    @Override
    public List<StatParamVO> listOpenReportRecordParams() {
        List<StatParamVO> result = new ArrayList<>();
        StatParamVO statusParam = new StatParamVO("status", "状态", FieldType.NUMBER);
        statusParam.setList(true);
        statusParam.setMulti(true);
        List<DropDownVO> statusDropDownVOS = new ArrayList<>();
        for (DataStatus dataStatus : DataStatus.values()) {
            statusDropDownVOS.add(new DropDownVO(dataStatus.getStatusFlag(), dataStatus.getStatus()));
        }
        statusParam.setListData(statusDropDownVOS);
        result.add(statusParam);
        // 年月时间筛选项、表名筛选项由前端写死处理 本方法只返回需要额外增添的查询参数
        StatParamVO yearParam = new StatParamVO("years", "年", FieldType.NUMBER);
//        yearParam.setList(true);
//        List<DropDownVO> dropDownVOS = new ArrayList<>();
//        yearParam.setListData(dropDownVOS);
//        for (int i = 2013; i <= Calendar.getInstance().get(Calendar.YEAR); i++) {
//            dropDownVOS.add(new DropDownVO(i + "年", i));
//        }
        result.add(yearParam);
        StatParamVO monthParam = new StatParamVO("months", "月", FieldType.NUMBER);
//        monthParam.setList(true);
//        List<DropDownVO> monthDropDownVOS = new ArrayList<>();
//        monthParam.setListData(monthDropDownVOS);
//        for (int i = 1; i <= 12; i++) {
//            monthDropDownVOS.add(new DropDownVO(i + "月", i));
//        }
        result.add(monthParam);
        StatParamVO tableParam = new StatParamVO("tableName", "查询公开表", FieldType.CHAR);
//        tableParam.setList(true);
//        // 这里不返回下拉项 留给controller另外设属性返回 这样可以一起传诸如公开时间类型等其他参数
////        List<DropDownVO> tableDropDownVOS = new ArrayList<>();
////        for (TableTypeVO tableType : navigateService.listTableTypesByMenuId(getMenuIdByYwType(ywType))) {
////            tableDropDownVOS.add(new DropDownVO(tableType.getDescription(), tableType.getTableName()));
////        }
////        tableParam.setListData(tableDropDownVOS);
        result.add(tableParam);
        // 日期参数由起止两个框构成 所以fieldName传的两个
//        result.add(new StatParamVO("publicDateBegin,publicDateEnd", "规定公开时间", FieldType.DATE));
        result.add(new StatParamVO("uploadDateBegin,uploadDateEnd", "发布时间", FieldType.DATE));
        return result;
    }


}
